home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / rdflib / syntax / parsers / NTParser.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.7 KB  |  32 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from rdflib.syntax.parsers import Parser
  5. from rdflib.syntax.parsers.ntriples import NTriplesParser
  6.  
  7. class NTSink(object):
  8.     
  9.     def __init__(self, graph):
  10.         self.graph = graph
  11.  
  12.     
  13.     def triple(self, s, p, o):
  14.         self.graph.add((s, p, o))
  15.  
  16.  
  17. import codecs
  18.  
  19. class NTParser(Parser):
  20.     
  21.     def __init__(self):
  22.         super(NTParser, self).__init__()
  23.  
  24.     
  25.     def parse(self, source, sink, baseURI = None):
  26.         f = source.getByteStream()
  27.         parser = NTriplesParser(NTSink(sink))
  28.         parser.parse(f)
  29.         f.close()
  30.  
  31.  
  32.